<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
  <title>
    Create a layer from a portal item | Sample | ArcGIS API for JavaScript
    4.18
  </title>

  <style>
    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
      overflow: hidden;
    }
  </style>

  <link rel="stylesheet" href="https://js.arcgis.com/4.18/esri/themes/light/main.css"/>

  <script src="https://js.arcgis.com/4.18/"></script>

  <script>
    require([
      "esri/Map",
      "esri/views/SceneView",
      "esri/layers/Layer"
    ], function (Map, SceneView, Layer) {
      var map = new Map({
        basemap: "gray-vector"
      });

      var view = new SceneView({
        map: map,
        container: "viewDiv",
        zoom: 7,
        center: [-87, 34]
      });

      Layer.fromPortalItem({
        portalItem: {
          // autocasts as new PortalItem()
          id: "8444e275037549c1acab02d2626daaee"
        }
      }).then((layer)=>{
        map.add(layer);
      });
    });
  </script>
</head>

<body>
<div id="viewDiv"></div>
</body>
</html>
